<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="layout" content="wechat"/>
    <title>免费评房</title>
</head>

<body>
<header class="create-header">
        <ul class="creat-flowList flex-box">
            <li data-id="01" class="flex1 active">
                <span></span>

                <h3>小区信息</h3>
            </li>
            <li data-id="02" class="flex1">
                <span></span>

                <h3>房产信息</h3>
            </li>
            <li data-id="03" class="flex1">
                <span></span>

                <h3>极速询值</h3>
            </li>
        </ul>
</header>

<div class="createStep2 bgcWhite">
  <form action="wxCreate2Step2" method="post" class="wxCreate2Form1">
    <input type="hidden" name="openId" value="${this.params.openId}"/>
    <input type="hidden" name="city" value="${this.house?.city?.id}"/>
    <input type="hidden" name="district" value="${this.house.district}"/>
    <div class="bgcWhite wxCreate weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">小区名称</label></div>
            <div class="weui-cell__bd weui-cell_primary">
              <input id="projectNameText" class="weui-input" type="text" name="projectName" value="${this.house?.projectName}"  placeholder="如：花家地西里一区" autocomplete="off"/>
            </div>
        </div>
    </div>
    <div class="bigBtn">
        <button type="submit" class="linkBtn weui-btn weui-btn_plain_default">查询</button>
    </div>
  </form>

    <div class="weui-panel weui-panel_access">
        <g:if test="${projectNameList?.size != 0}">
            <div class="weui-panel__hd">您要找的小区可能是</div>
        </g:if>
        <div class="weui-panel__bd addressList" >
            <g:each in="${projectNameList}" var="entry">
                <g:if test="${entry}">
                    <div class="weui-media_box weui-media_text addressItem">
                        <h4 class="weui-media_title">${entry.communityName}</h4>

                        <p class="weui-media_desc">${entry.address}</p>
                        <span class="hide">${entry.communityId}</span>
                    </div>
                </g:if>
            </g:each>
        </div>
    </div>
    <h4 class="colorRed" style="margin-top: 4px">未找到对应的小区？</h4>
    <div class="deleteInfo">
      <span class="link" id="retry">再次尝试</span>
        <span>或</span>
        <span class="link" id="submitBtn2">直接提交</span>
    </div>
</div>

<form resource="${this.house}" action="wxCreate2Step3" id="wxCreate2Form2" method="post" class="wxCreate2Form2">
    <input type="hidden" name="projectName" id="projectName"/>
    <input type="hidden" name="city" value="${this.house?.city.id}"/>
    <input type="hidden" name="district" value="${this.house?.district}"/>
    <input type="hidden" name="openId" value="${this.params.openId}"/>
    <input type="hidden" name="communityId" value="" id="communityId"/>
</form>


%{--提示信息和验证--}%
<div class="message-box">
    <div class="helpMsg hide"></div>
    <g:if test="${flash.message}">
        <div class="message" role="status">
            ${flash.message}
        </div>
    </g:if>
</div>

<script>
    $(function(){
        $(".addressList").delegate(" .addressItem", "click", function () {
            var housecell = $(this).children("h4").text().trim();
            $("#projectName").val(housecell);
            var communityId = $(this).children("span").text().trim();
            $("#communityId").val(communityId);
            $("#wxCreate2Form2").submit();
        });

        $("#submitBtn2").click(function () {
            $("#projectName").val($("#projectNameText").val());
            $("#wxCreate2Form2").submit();
        });

        setTimeout(function () {
            $(".message").fadeOut(200);
        }, 2000);
    })
</script>
</body>
</html>
